package ar.com.fiuba.domain.impl.misspell;

import java.util.ArrayList;
import java.util.List;

public class MisspelledWordsGeneratorWithSubstitution extends MisspelledWordsGenerator {

	public MisspelledWordsGeneratorWithSubstitution(String inputFileName, int numberOfWords) {
		super(inputFileName, numberOfWords);
	}

	public List<String> generateErrorAtTheBeginning() {
		List<String> wordsWithError = new ArrayList<String>();
		for (String s : correctWordsArray) {
			String aux = s;
			wordsWithError.add("v" + aux.substring(1, aux.length()));
		}
		return wordsWithError;
	}

	public List<String> generateErrorAtTheEnd() {
		List<String> wordsWithError = new ArrayList<String>();
		for (String s : correctWordsArray) {
			String aux = s;
			wordsWithError.add(aux.substring(0, aux.length() - 1) + "v");
		}
		return wordsWithError;
	}

	public List<String> generateErrorInTheMiddle() {
		List<String> wordsWithError = new ArrayList<String>();
		for (String s : correctWordsArray) {
			String aux = s;
			wordsWithError.add(aux.substring(0, 2) + "v" + aux.substring(2, aux.length()));
		}
		return wordsWithError;
	}

	public String getFileNamePrefix() {
		return "substitutionErrors";
	}

}
